Skip to content

🛤️ feat: Per-Agent Code Execution Routing With Stateful Session Scopes - #14848

Merged
danny-avila merged 9 commits into
devfrom
danny-avila/per-agent-code-profiles
Aug 16, 2026
Merged

🛤️ feat: Per-Agent Code Execution Routing With Stateful Session Scopes#14848
danny-avila merged 9 commits into
devfrom
danny-avila/per-agent-code-profiles

Conversation

@danny-avila

Copy link
Copy Markdown
Owner

Summary

  • keep stateless HTTP/libkrun as the AWS-free default execution profile
  • route agents with Stateful code sessions enabled to the dedicated stateful Code API endpoint
  • resolve routing from the actually executing agent across handoffs, subagents, PTC, prewarm, and host file operations
  • add per-agent stateful environment scope: user (default and recommended), agent + user, or conversation
  • partition transient session IDs and file refs so stateless and stateful profiles never bleed into each other
  • fail closed when the stateful endpoint is unavailable; never silently fall back to stateless

Dependencies

Verification

  • data-provider, data-schemas, and API package builds
  • client TypeScript check
  • 241 focused packages/api tests
  • 186 focused server tests
  • AgentPanel helper tests
  • ESLint on all changed source files
  • mixed-profile, scope isolation, prewarm, host file routing, and session partition regression coverage

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 592f7fd270

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/agents/prewarm.ts
Comment thread api/server/services/Endpoints/agents/initialize.js
Comment thread packages/api/src/agents/execution.ts Outdated
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

const isCodeExecutionToolRequested = isBashToolRequested || isLegacyExecuteCodeRequested;
let enabledCapabilities;
if (actionsEnabled === undefined || isPTCRequested || isCodeExecutionToolRequested) {
enabledCapabilities = await resolveAgentCapabilities(req, appConfig, agent?.id);

P1 Badge Resolve capabilities for sandbox file tools

In normal event-driven runs, actionsEnabled is already populated, and calls to read_file, create_file, or edit_file match neither PTC nor the two code-execution names checked here. Capability resolution is therefore skipped, codeExecutionEnabled becomes false, and the resulting context routes these host-side file operations to the default stateless endpoint. Stateful agents consequently cannot read files from their dedicated workspace and may write edits into the wrong service; include the sandbox file tools in this gate or carry the initialized per-agent execution context directly.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/server/services/ToolService.js
Comment thread packages/api/src/agents/prewarm.ts
Comment thread api/server/services/Files/Code/process.js
Comment thread packages/api/src/agents/run.ts Outdated
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a09245543

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/agents/initialize.ts Outdated
Comment thread packages/api/src/agents/handlers.ts Outdated
@danny-avila
danny-avila marked this pull request as ready for review August 15, 2026 12:11
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b77e8e06b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/agents/codeFilesSession.ts Outdated
Comment thread packages/api/src/agents/prewarm.ts
Comment thread api/server/services/Files/Code/process.js
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a86241f67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/agents/codeFilesSession.ts
Comment thread api/server/services/Files/Code/process.js
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f49c3f343b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/server/services/ToolService.js
@danny-avila

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: a2ea22f9de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila danny-avila changed the title feat: route code execution per agent profile 🛤️ feat: Per-Agent Code Execution Routing With Stateful Session Scopes Aug 16, 2026
@danny-avila
danny-avila merged commit 06bf324 into dev Aug 16, 2026
33 checks passed
@danny-avila
danny-avila deleted the danny-avila/per-agent-code-profiles branch August 16, 2026 13:42
LogicalAbsurd pushed a commit to LogicalAbsurd/LibreChat that referenced this pull request Aug 27, 2026
danny-avila#14848)

* feat: route code execution per agent profile

* chore: sort execution profile imports

* test: preserve stateful environment literal types

* fix: isolate stateful code environments by user

* fix: preserve per-agent code routing end to end

* fix: route code priming by execution profile

* fix: isolate code profile lifecycle state

* fix: preserve mixed-profile code resources

* fix: complete stateful skill routing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant